import {_http} from '@/axios/http';
import path from '@/axios/path';

const state = {};

const getters = {};

const actions = {
  //admin
  getadminList({commit}, data) {
    return _http(`${path.adminList}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getuserAdd({commit}, data) {
    return _http(`${path.userAdd}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getuserUpdate({commit}, data) {
    return _http(`${path.userUpdate}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },

  //access
  getaccessList({commit}, data) {
    return _http(`${path.accessList}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getaccessUpdate({commit}, data) {
    return _http(`${path.accessUpdate}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getaccessAdd({commit}, data) {
    return _http(`${path.accessAdd}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getaccessMenu({commit}, data) {
    return _http(`${path.accessMenu}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getaccessRole({commit}, data) {
    return _http(`${path.accessRole}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },

  //role
  getroleList({commit}, data) {
    return _http(`${path.roleList}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getroleUpdate({commit}, data) {
    return _http(`${path.roleUpdate}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getroleAdd({commit}, data) {
    return _http(`${path.roleAdd}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getroleAccessUpdate({commit}, data) {
    return _http(`${path.roleAccessUpdate}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getroleChild({commit}, data) {
    return _http(`${path.roleChild}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },

  //menu
  getmenuList({commit}, data) {
    return _http(`${path.menuList}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },

  getmenuParant({commit}, data) {
    return _http(`${path.menuParant}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getmenuUpdate({commit}, data) {
    return _http(`${path.menuUpdate}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getmenuAdd({commit}, data) {
    return _http(`${path.menuAdd}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },

  //log
  getlogList({commit}, data) {
    return _http(`${path.logList}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
  getusergetChild({commit}, data) {
    return _http(`${path.usergetChild}`, data)
      .then(res => {return res})
      .catch(err => {return err})
  },
}
const mutations = {

};
export default {
  state,
  getters,
  mutations,
  actions
}
